function check() {
    if(document.getElementsByName("attribute1")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Description should not be null."
        return false;
    }
    if(document.getElementsByName("listPrice")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "List price should not be null."
        return false;
    }
    if(document.getElementsByName("stockQuantity")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Quantity should not be null."
        return false;
    }
    return true;
}

function checkAdd() {
    if(document.getElementsByName("itemId")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Item id should not be null."
        return false;
    }
    if(document.getElementsByName("attribute1")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Description should not be null."
        return false;
    }
    if(document.getElementsByName("listPrice")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "List price should not be null."
        return false;
    }
    if(document.getElementsByName("unitcost")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Unitcost should not be null."
        return false;
    }
    if(document.getElementsByName("stockQuantity")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Quantity should not be null."
        return false;
    }
    return true;
}